package com.th.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum BankcardType {

    DEBITCARD(0,"借记卡"),
    CREDITCARD(1,"信用卡");

    private Integer code;
    private String name;

    public static BankcardType of(Integer code){
        return Stream.of(values()).
                filter(bean -> bean.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
